home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 7_5.lha / 7_5 / 7_5a2_rect.c < prev    next >
Text File  |  1993-08-08  |  596b  |  24 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. / Exercise 7.5
  6. / rectangle derived from a line
  7. lass rectangle : public line
  8.  
  9.    point &sw() { return w; }
  10.    point &ne() { return e; }
  11.  
  12. ublic:
  13.    point north() { return point((sw().x+ne().x)/2,ne().y); }
  14.    point east();
  15.    point south() { return point((sw().x+ne().x)/2,sw().y); }
  16.    point west();
  17.    point neast() { return ne(); }
  18.    point seast();
  19.    point swest() { return sw(); }
  20.    point nwest();
  21.    void draw();
  22.    rectangle(point a, point b);
  23. ;
  24.